Byte Stream

Data clustering provides a means of packaging an arbitrary collection of Prograph objects (including handles to Macintosh structures) into byte streams, suitable for storage in disk files or transmission between applications or machines. This mechanism is used internally by Prograph, by the Datafile Manager and by the load and save primitives.

The data clustering facility is available through the primitives to-bytes, from-bytes, and clear-bytes-map. These primitives are useful in implementing applications dealing with IAC, LocalTalk, communications and resource management.

_________________________________________________
                                                  clear-bytes-map
*263*

Input types:
ABlock@@

Description: 
A class translation map contains the names and addresses of classes of values packaged in a cluster generated by to-bytes. However, if the data has been transmitted to an application or read into a new application, the addresses of the classes stored in the map will be invalid. clear-bytes-map will flag all class addresses stored in the map as invalid, forcing from-bytes to look up the correct class addresses. Unless you are sure of the validity of the map, call clear-bytes-map prior to from-bytes (this slows down translation time).

See also: to-bytes, from-bytes

_________________________________________________
                              from-bytes
 *264*

Input types:
ABlock@@; ABlock@@

Output types:
integer; any

Description:  Takes a handle of bytes originally generated by to-bytes and reconstitutes the bytes into their original Prograph data values. The class translation map used to construct the handle must also be provided.

See also:
to-bytes, clear-bytes-map

_________________________________________________
 
                                      to-bytes
 *264*

Input names: Value; [OldMap]

Input types: any; [ABlock@@]

Output types: ABlock@@; ABlock@@

Description:  Takes an arbitrary Prograph data object and generates a handle of bytes (cluster). The contents of the handle generated by to-bytes can then be written to disk, stored as a resource, placed in the scrapbook or clipboard, or transmitted to another application via IAC. to-bytes also generates a second handle of bytes containing a class translation map. This map contains information necessary to remap objects into their appropriate classes. Since the same map could be applied to several values, it is kept separate and thereby reduces the number of bytes necessary to represent large data sets.

See also:
from-bytes, clear-bytes-map